package com.ruochen.recipe.ui.fragment.order;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import com.ruochen.common.adapter.FragmentViewPagerAdapter;
import com.ruochen.common.base.BaseMvpFragment;
import com.ruochen.recipe.databinding.FragmentOrderBinding;
import com.ruochen.recipe.mvp.order.OrderCovenant;
import com.ruochen.recipe.mvp.order.OrderPresenter;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description 我的订单
 * @Auth RuoChen
 * @Date 13/03/2021, 12:58
 **/
public class OrderFragment extends BaseMvpFragment<FragmentOrderBinding, OrderPresenter> implements OrderCovenant.MvpView {

    private String[] titles = new String[]{"全部订单", "待配送", "已结束"};

    @Override
    protected void initView(Bundle savedInstanceState) {
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(new OrderStateFragment());
        fragments.add(new OrderStateFragment());
        fragments.add(new OrderStateFragment());
        viewBinding.vpStatePager.setAdapter(new FragmentViewPagerAdapter(getChildFragmentManager(), fragments, titles));
        viewBinding.vpStatePager.setOffscreenPageLimit(3);
        viewBinding.stlStateTab.setViewPager(viewBinding.vpStatePager);
        viewBinding.stlStateTab.setSnapOnTabClick(true);
    }

    @Override
    protected OrderPresenter createPresenter() {
        return new OrderPresenter(this);
    }

}
